<?php
namespace api\know\controller;

use cmf\controller\RestBaseController;
use api\know\model\SysConfigModel;

class SysConfigController extends RestBaseController
{
    public function getList()
    {
        $type = $this->request->param('type', '');
        $w = ['is_delete' => 0 ];
        if ($type)
        {
            $w['type'] = $type;
        }

        $rows = SysConfigModel::where($w)
                            ->order('order_number', 'desc')
                            ->field(SysConfigModel::$QueryField)
                            ->select();
        $d = [];
        foreach($rows as $v)
        {
            if (empty($d[$v['type']]))
            {
                $d[$v['type']] = [];
            }
            array_push($d[$v['type']], $v);
        }

        $this->success('请求成功!', $d);
    }
}
